﻿using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace 纸片人.win2dEffectControl.DataClass
{
    public class ScaleEffectData : EffectOneSourceData
    {
        private Vector2 centerPoint = new Vector2(0, 0);
        private CanvasImageInterpolation interpolationMode= CanvasImageInterpolation.NearestNeighbor;
        private Vector2 scale =new Vector2(1,1);
        private float sharpness =0;
        private EffectBorderMode borderMode = EffectBorderMode.Soft;

        public float Sharpness { get => sharpness; set { sharpness = value; OnPropertyChanged(); SetIsChanges(); } }
        public Vector2 Scale { get => scale; set { scale = value; OnPropertyChanged(); SetIsChanges(); } }
        public CanvasImageInterpolation InterpolationMode { get => interpolationMode; set { interpolationMode = value; OnPropertyChanged(); SetIsChanges(); } }
        public Vector2 CenterPoint { get => centerPoint; set { centerPoint = value; OnPropertyChanged(); SetIsChanges(); } }
        public EffectBorderMode BorderMode { get => borderMode; set { borderMode = value; OnPropertyChanged(); SetIsChanges(); } }
        #region 属性

        #endregion
        public override ICanvasImage GetEffect(CanvasDevice device, bool compression)
        {
            var source = GetSourceEffect(device, compression);
            if (source == null)
                return null;

            var effect = new ScaleEffect()
            {
                Source = source,
                BorderMode = BorderMode,
                CenterPoint = CenterPoint,
                InterpolationMode = InterpolationMode,
                Scale = Scale,
                Sharpness = Sharpness
            };
            return effect;
        }


    }
}